package net.ikenway.springboot.demo.Model.Entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author MasterKenway <zk@ikenway.net>
 * @Description
 * @date Created Date 12/10/2020
 */
@Entity
@DynamicUpdate
@Data
@Table(name = "activities")
@NoArgsConstructor
@AllArgsConstructor
public class Activity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long actId;

    @Column(unique = true)
    private String actName;

    private String imageUrl;
//    private String pageUrl;


    private BigDecimal disCount;

    @ManyToMany(targetEntity = Product.class, cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    private List<Product> products;

    @Column(unique = true)
    private Integer displayOrder;

    private Boolean enable = true;
}
